cmake_minimum_required(VERSION 2.8)
project(rvo_ros)

set(CMAKE_CXX_STANDARD 11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  geometry_msgs
  std_msgs
  message_generation
)

find_package(gazebo REQUIRED)

include_directories(
 include
 ${catkin_INCLUDE_DIRS}
 ${PROJECT_SOURCE_DIR}/include/3d_library  # 确保这里包含了3d_library目录
 ${PROJECT_SOURCE_DIR}../../devel/include/rvo_ros  #确保message的头文件可以找到
)

#查看一下PROJECT_SOURCE_DIR的直
message(STATUS "@@@@@@@@PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}$")

link_directories(${catkin_LIBRARY_DIRS})

add_service_files(
  DIRECTORY srv
  FILES SetGoals.srv
)

add_message_files(
  FILES
  UAVPosVel.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
  geometry_msgs
  )

catkin_package(
#  INCLUDE_DIRS includels -l /home/tju/catkin_ws_orca/src/orca/msg/UavPosVel.msg

#  LIBRARIES robohan
#  CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy tf
CATKIN_DEPENDS roscpp message_runtime std_msgs geometry_msgs
)

# file(GLOB RVO_LIB_DIRS "rvo_lib/nav_rvo.cpp")

add_subdirectory(simulation/plugins)
#add_library(rvolib SHARED rvo_lib/nav_rvo.cpp rvo_lib/RVOSimulator.cpp rvo_lib/Agent.cpp rvo_lib/KdTree.cpp rvo_lib/Obstacle.cpp)

add_library(rvolib SHARED include/3d_library/nav_rvo.cpp include/3d_library/RVOSimulator.cpp include/3d_library/Agent.cpp include/3d_library/KdTree.cpp)


# ============================ 仿真 =================================
add_executable(rvo_node_0 src/rvo_node/rvo_node_0.cpp)
target_link_libraries(rvo_node_0 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_0 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_1 src/rvo_node/rvo_node_1.cpp)
target_link_libraries(rvo_node_1 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_1 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_2 src/rvo_node/rvo_node_2.cpp)
target_link_libraries(rvo_node_2 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_2 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_3 src/rvo_node/rvo_node_3.cpp)
target_link_libraries(rvo_node_3 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_3 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_4 src/rvo_node/rvo_node_4.cpp)
target_link_libraries(rvo_node_4 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_4 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_5 src/rvo_node/rvo_node_5.cpp)
target_link_libraries(rvo_node_5 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_5 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_6 src/rvo_node/rvo_node_6.cpp)
target_link_libraries(rvo_node_6 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_6 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_7 src/rvo_node/rvo_node_7.cpp)
target_link_libraries(rvo_node_7 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_7 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_8 src/rvo_node/rvo_node_8.cpp)
target_link_libraries(rvo_node_8 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_8 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_9 src/rvo_node/rvo_node_9.cpp)
target_link_libraries(rvo_node_9 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_9 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_10 src/rvo_node/rvo_node_10.cpp)
target_link_libraries(rvo_node_10 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_10 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_11 src/rvo_node/rvo_node_11.cpp)
target_link_libraries(rvo_node_11 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_11 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_12 src/rvo_node/rvo_node_12.cpp)
target_link_libraries(rvo_node_12 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_12 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_13 src/rvo_node/rvo_node_13.cpp)
target_link_libraries(rvo_node_13 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_13 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_14 src/rvo_node/rvo_node_14.cpp)
target_link_libraries(rvo_node_14 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_14 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_15 src/rvo_node/rvo_node_15.cpp)
target_link_libraries(rvo_node_15 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_15 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_16 src/rvo_node/rvo_node_16.cpp)
target_link_libraries(rvo_node_16 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_16 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_17 src/rvo_node/rvo_node_17.cpp)
target_link_libraries(rvo_node_17 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_17 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_18 src/rvo_node/rvo_node_18.cpp)
target_link_libraries(rvo_node_18 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_18 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_19 src/rvo_node/rvo_node_19.cpp)
target_link_libraries(rvo_node_19 ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_19 ${${PROJECT_NAME}_EXPORTED_TARGETS})





add_executable(set_goals_client_0 src/set_goals/set_goals_client_0.cpp)
target_link_libraries(set_goals_client_0 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_0 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_1 src/set_goals/set_goals_client_1.cpp)
target_link_libraries(set_goals_client_1 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_1 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_2 src/set_goals/set_goals_client_2.cpp)
target_link_libraries(set_goals_client_2 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_2 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_3 src/set_goals/set_goals_client_3.cpp)
target_link_libraries(set_goals_client_3 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_3 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_4 src/set_goals/set_goals_client_4.cpp)
target_link_libraries(set_goals_client_4 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_4 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_5 src/set_goals/set_goals_client_5.cpp)
target_link_libraries(set_goals_client_5 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_5 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_6 src/set_goals/set_goals_client_6.cpp)
target_link_libraries(set_goals_client_6 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_6 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_7 src/set_goals/set_goals_client_7.cpp)
target_link_libraries(set_goals_client_7 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_7 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_8 src/set_goals/set_goals_client_8.cpp)
target_link_libraries(set_goals_client_8 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_8 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_9 src/set_goals/set_goals_client_9.cpp)
target_link_libraries(set_goals_client_9 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_9 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_10 src/set_goals/set_goals_client_10.cpp)
target_link_libraries(set_goals_client_10 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_10 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_11 src/set_goals/set_goals_client_11.cpp)
target_link_libraries(set_goals_client_11 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_11 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_12 src/set_goals/set_goals_client_12.cpp)
target_link_libraries(set_goals_client_12 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_12 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_13 src/set_goals/set_goals_client_13.cpp)
target_link_libraries(set_goals_client_13 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_13 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_14 src/set_goals/set_goals_client_14.cpp)
target_link_libraries(set_goals_client_14 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_14 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_15 src/set_goals/set_goals_client_15.cpp)
target_link_libraries(set_goals_client_15 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_15 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_16 src/set_goals/set_goals_client_16.cpp)
target_link_libraries(set_goals_client_16 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_16 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_17 src/set_goals/set_goals_client_17.cpp)
target_link_libraries(set_goals_client_17 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_17 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_18 src/set_goals/set_goals_client_18.cpp)
target_link_libraries(set_goals_client_18 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_18 ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_19 src/set_goals/set_goals_client_19.cpp)
target_link_libraries(set_goals_client_19 ${catkin_LIBRARIES})
add_dependencies(set_goals_client_19 ${${PROJECT_NAME}_EXPORTED_TARGETS})


# =================================== 真实 =====================================
# add_executable(rvo_node_0_true src/rvo_node_0_true.cpp)
# target_link_libraries(rvo_node_0_true ${catkin_LIBRARIES} rvolib)
# add_dependencies(rvo_node_0_true ${${PROJECT_NAME}_EXPORTED_TARGETS})

# add_executable(set_goals_client_0_true src/set_goals_client_0_true.cpp)
# target_link_libraries(set_goals_client_0_true ${catkin_LIBRARIES})
# add_dependencies(set_goals_client_0_true ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(rvo_node_1_true src/rvo_node_1_true.cpp)
target_link_libraries(rvo_node_1_true ${catkin_LIBRARIES} rvolib)
add_dependencies(rvo_node_1_true ${${PROJECT_NAME}_EXPORTED_TARGETS})

add_executable(set_goals_client_1_true src/set_goals_client_1_true.cpp)
target_link_libraries(set_goals_client_1_true ${catkin_LIBRARIES})
add_dependencies(set_goals_client_1_true ${${PROJECT_NAME}_EXPORTED_TARGETS})

# add_dependencies(set_goals_client )

add_executable(formation src/formation.cpp)
target_link_libraries(formation ${catkin_LIBRARIES})
add_dependencies(formation ${${PROJECT_NAME}_EXPORTED_TARGETS})

#target_link_libraries(rvo_test RVO)
